package com.yym.cloudweb.crawl.station.dadianjing;

import com.yym.cloudweb.crawl.util.CrawlUtil;

import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.processor.PageProcessor;


public class DianjinghuDetailPageProcessor implements PageProcessor {

    private Site site = Site.me().setRetryTimes(3).setSleepTime(1000).setTimeOut(10000);

    @Override
    public void process(Page page) {
        String html = page.getHtml().toString();
        String xpath = "//div[@class='new_conts]/text()";
        Object res = CrawlUtil.getValByXpath(html,xpath);
        System.out.println(res);
    }

    @Override
    public Site getSite() {
        return site;
    }



    public static void main(String[] args) {
        //Spider.create(new DianjinghuDetailPageProcessor()).addUrl("https://lol.dianjinghu.com/news/84554.html").setDownloader(Downloader.getInstance()).thread(5).run();
    }

}
